#include "QbTFBondIntegrated.h"

#include <QHBoxLayout>
#include <QList>
#include <QSplitter>
#include <QStylePainter>
#include <QVBoxLayout>

#include "QbTFBondKLine.h"
#include "QbTFBondTable.h"
#include "QbTFBondTrend.h"

QbTFBondIntegrated::QbTFBondIntegrated(QWidget* parent) : QWidget(parent) {
  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

  QVBoxLayout* v = new QVBoxLayout(this);
  v->setContentsMargins(0, 0, 0, 0);

  QbTFBondTable* table = new QbTFBondTable(this);
  QWidget* bottomWidget = new QWidget(this);
  QSplitter* splitter = new QSplitter(Qt::Vertical);
  splitter->addWidget(table);
  splitter->addWidget(bottomWidget);
  splitter->setStretchFactor(0, 1);
  splitter->setStretchFactor(1, 1);

  QVBoxLayout* v2 = new QVBoxLayout(bottomWidget);
  QWidget* bottomWidget2 = new QWidget(bottomWidget);
  v2->addWidget(bottomWidget2);

  QHBoxLayout* h = new QHBoxLayout(bottomWidget2);
  QbTFBondTrend* trend = new QbTFBondTrend(bottomWidget2);
  QbTFBondKLine* kline = new QbTFBondKLine(bottomWidget2);
  h->addWidget(trend);
  h->addWidget(kline);
  h->setStretchFactor(trend, 1);
  h->setStretchFactor(kline, 1);
  h->setSpacing(0);
  v->addWidget(splitter);
}

void QbTFBondIntegrated::paintEvent(QPaintEvent* event) {
  QStylePainter painter(this);
  painter.fillRect(rect(), Qt::gray);
}
